//
//  StrategyListTableViewCell.m
//  MyDIYHouse
//
//  Created by dlios on 15-6-29.
//  Copyright (c) 2015年 李平洋. All rights reserved.
//

#import "StrategyListTableViewCell.h"

#define WIDTH self.contentView.frame.size.width

@implementation StrategyListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.picImageView = [[UIImageView alloc] init];
        //self.picImageView.backgroundColor = [UIColor yellowColor];
        [self.contentView addSubview:self.picImageView];
        
        self.titleLabel = [[UILabel alloc] init];
        // self.titleLabel.backgroundColor = [UIColor blueColor];
        self.titleLabel.font = [UIFont systemFontOfSize:18];
        [self.contentView addSubview:self.titleLabel];
        
        self.descriptionLabel = [[UILabel alloc] init];
        // self.descriptionLabel.backgroundColor = [UIColor blueColor];
        self.descriptionLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.descriptionLabel];
        self.descriptionLabel.numberOfLines = 2;
        
        self.userNameLabel = [[UILabel alloc] init];
        //self.userNameLabel.backgroundColor = [UIColor blueColor];
        self.userNameLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.userNameLabel];
        
        self.dateLabel = [[UILabel alloc] init];
        //self.dateLabel.backgroundColor = [UIColor blueColor];
        self.dateLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.dateLabel];
        self.dateLabel.textColor = [UIColor grayColor];
        
        
    }
    return self;
}


- (void)layoutSubviews
{
    
    
    [super layoutSubviews];
    self.picImageView.frame = CGRectMake(10, 10, (WIDTH-20)/2-10, 140);
    
    
    self.titleLabel.frame = CGRectMake((WIDTH-20)/2+10, 20, (WIDTH-20)/2-10, 30);
    self.descriptionLabel.frame =CGRectMake((WIDTH-20)/2+10, 70, (WIDTH-20)/2-10, 50);
    self.userNameLabel.frame = CGRectMake((WIDTH-20)/2+10, 130, (WIDTH-20)/6+20, 25);
    self.dateLabel.frame = CGRectMake((WIDTH-20)/9*7, 130,  (WIDTH-20)/4, 25);
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
